<template>
  <view class="content">
    <view class="header">
      <view class="header-menu" @click="onMenu">
        <view class="uni-icon uni-icon-menu"></view>
      </view>
      <view class="header-search" @click="goSearch">
        <view class="header-search__text">搜索关键词</view>
        <view class="uni-icon uni-icon-search"></view>
      </view>
      <view class="header-user">plain</view>
    </view>
    <Swiper />
    <week />
    <week :type="0" />
    <uni-drawer :visible="visible" @close="closeMenu">
      <view>11222</view>
    </uni-drawer>
  </view>
</template>

<script>
import week from '@/components/week/index.vue'
import Swiper from '@/components/Swiper'
import uniDrawer from '@/components/uni-drawer/uni-drawer.vue'
export default {
  data () {
    return {
      scrollTop: 0,
      title: 'Hello',
      visible: false
    };
  },
  onLoad () {
    console.log(uni.getStorageSync('token'))
  },
  methods: {
    onMenu () {
      this.visible = true
    },
    closeMenu () {
      this.visible = false
    },
    goSearch () {
      uni.navigateTo({
        url: '/pages/search/index'
      })
    }
  },
  components: {
    week,
    Swiper,
    uniDrawer
  },
  onPullDownRefresh () {
    console.log('refresh');
    setTimeout(function () {
      uni.stopPullDownRefresh();
    }, 1000);
  }
};
</script>
<style lang="scss" scoped>
.scroll-Y {
  height: 100vh;
}

.header {
  position: fixed;
  top: 0;
  left: 20rpx;
  right: 20rpx;
  padding-top: calc(var(--status-bar-height));
  height: calc(80rpx + var(--status-bar-height));
  z-index: 9;
  display: flex;
  color: #fff;
  align-items: center;

  &-search {
    margin: 10rpx auto;
    width: 500rpx;
    height: 60rpx;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 30rpx;
    font-size: 24rpx;
    display: flex;
    color: #666;

    &__text {
      width: 440px;
      height: 60rpx;
      line-height: 60rpx;
      padding-left: 30rpx;
    }
  }

  .uni-icon-search {
    margin-top: 12rpx;
    margin-right: 20rpx;

    &:before {
      font-size: 36rpx;
    }
  }
}

.content {
  padding-bottom: calc(20rpx + var(--window-bottom));
}
</style>
